import matplotlib as mpl
import scipy
from scipy import constants as C
import scipy.special as S
import numpy as np
import pylab as pl

mpl.rcParams['font.sans-serif'] = ['SimHei']
print(scipy.__version__)
print(C.c)
print(C.h)
C.physical_constants["electron mass"]

print(C.mile)
print(C.inch)
print(C.gram)
print(C.pound)

print(1 + 1e-20)
print(np.log(1 + 1e-20))
print(S.log1p(1e-20))

m = np.linspace(0.1, 0.9, 4)
u = np.linspace(-10, 10, 200)
results = S.ellipj(u[:, None], m[None, :])
print([y.shape for y in results])

fog, axes = pl.subplots(2, 2, figsize=(12, 4))
labels = ["$sn$", "$cn$", "$dn$", "$\phi$"]
for ax, y, label in zip(axes.ravel(), results, labels):
    ax.plot(u, y)
    ax.set_ylabel(label)
    ax.margins(0, 0.1)

axes[1, 1].legend(["$m={:g}$".format(m_) for m_ in m], loc="best", ncol=2);
